<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>中国传媒大学设备预约平台</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="{$projectUrl}/css/admin_style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{$projectUrl}/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{$projectUrl}/js/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="{$projectUrl}/js/globalJsFunction.js"></script>
<script type="text/javascript">
{literal}
$(document).ready(function(){
    $('#slideshow').cycle({
        fx:     'fade',
        speed:  'slow',
        timeout: 3000,
        pager:  '#slider_nav',
        pagerAnchorBuilder: function(idx, slide) {
            // return sel string for existing anchor
            return '#slider_nav li:eq(' + (idx) + ') a';
        }
    });
});
{/literal}
</script>
</head>
<body>
<div class="main">
  <div class="main_resize">
    <div class="main_left">
      {include file=include/headerLogo.html}
      <div class="clr"></div>
      {include file=include/adminLeftMenu.html}
      <div class="clr"></div>
      <h2>&nbsp;</h2><!--
      <h2>Our News</h2>
      <p><span>12 Dec 2015 | 0 comments</span><br />
        <strong>Duis nec porttitor lorem</strong><br />
        Mauris et nisi urna nonfaucibus magna. Integer lacus ante then ullamcorper ut vulputate..</p>
      <p><span>14 Dec 2015 | 0 comments</span><br />
        <strong>Duis nec porttitor lorem</strong><br />
        Mauris et nisi urna nonfaucibus magna. Integer lacus ante then ullamcorper ut vulputate..</p>
      <h2>&nbsp;</h2>
      <h2>What They Say</h2>
      <p>&quot;Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse voluptas nulla pariatur?&quot;</p>
      <p><em><strong>by: John S., webdesigner</strong></em></p>-->
    </div>
    <div class="main_right">
      {include file=include/headerLogin.html}

      <div class="clr" style="background-color:#C63; height:1px;">&nbsp;</div>
      <div>
      {include file=include/adminTopMenu.html}
      </div>
      <div class="clr">
      	<p><span style="font-color:#C60; font-size:16px;">添加频道</span>
          <span style="font-color:#C60; font-size:16px; display:inline;"></span>(总个数:{$channelsNumber})</p>
      	 <!--创建设备-->

                <div id = "create_user_name" style="font-size:14px;">
                <form action="channel.php?action=addchannel" method="post">
                <input type="hidden" name="action" id="action" value="addchannel"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px">
                    	<tr>
                    		<td>名称</td>
                    		<td>介绍</td>
                    		<td>添加</td>
                    	</tr>
                    	<tr>
                    		<td><input type="text" id="name" name="name" size="14"/></td>
                    		<td><input type="text" id="info" name="info" size="40"/></td>
                    		<td><input type="image" src="{$projectUrl}/images/add1.jpg" class="button"/></td>
                    	</tr>
                    </table>
                </form>
                </div>
                <div>
                  <span style="align:center; color:red; font-size:12px">{$insertMessage}</span>
                  </div>
                <!--创建用户结束-->
      </div>

      <!-- 搜索用户并且进行修改 -->
      <div class="clr">
       <!--全部用户的列表-->
                <div>
                	<p>
                		<span>{if $searchNote eq ""}输入名字进行搜索
                		{else}{$searchNote}
                		{/if}
                		</span>
                		<span style="float:right">
					        <form id="form1" name="form1" method="get" action="channel.php">
					        	 <input type="hidden" name="action" id="action" value="search"/>
                                <input type="text" class="keywords" id="keyword" name="keyword" maxlength="50" value="{$keyword}"/>
                                <input name="b" type="submit" class="button" value="搜索" />
					        </form>
					        </span></p>

                <form id="channellist_form" action="channel.php?action=deletechannel&pageIndex={$pageIndex}" method="post" onsubmit="return window.confirm('确定删除？');">
                <input type="hidden" name="action" id="action" value="deletechannel"/>
                    <table width="100%" bgcolor="#FFFFFF" style="font-size:14px;">
                    <tr valign="top"  style="background-color:#C60">
                        <td>({$channels|@count})</td>
                        <td>名称</td>
                        <td>介绍</td>
                        <td>操作</td>
                    </tr>
                    {foreach from=$channels item=channelItem name=channellist}
                    <tr valign="top" onmouseout="this.style.backgroundColor=''"onmouseover="this.style.backgroundColor='#AAAAAA'">
                        <td><input type="checkbox" id="channels[]" name="channels[]" value="{$channelItem.id}"/></td>
                        <td><span title="{$channelItem.name}">{$channelItem.name|truncate:20:"..."|escape:'html'}</span></td>
                        <td><span title="{$channelItem.info}">{$channelItem.info|truncate:60:"..."|escape:'html'}</span></td>
                        <td><a href="channel.php?action=edit&id={$channelItem.id}#modifyChannelInfo">编辑</a></td>
                    </tr>
                    {/foreach}


                    <tr><td align="right" colspan="2">
                        <input type="button" value="全选" onclick='chkall("channellist_form")' />
                        <input type="reset" value="不选" />
                        </td>
                        <td align="left" colspan="2">
                        <input type="submit" value="删除选中"/>
                        </td>
                    </tr>
                     <tr>
                    <td colspan="8" align="center">
                    <a href="channel.php?pageIndex={$leftPageIndex}">&lt;</a>

                    {section start=$leftMostPageIndex loop=$pageIndex step=1 name=pagesection}
                    <a href="channel.php?pageIndex={$smarty.section.pagesection.index}">
                    {$smarty.section.pagesection.index}&nbsp;&nbsp;
                    </a>
                    {/section}
                    <span style="font-size:18px;"><Strong><bold>{$pageIndex}</bold></Strong>&nbsp;</span>
                    {section start=$pageIndex+1 loop=$rightMostPageIndex+1 step=1 name=rightpagesection}
                    <a href="channel.php?pageIndex={$smarty.section.rightpagesection.index}">
                    {$smarty.section.rightpagesection.index}&nbsp;&nbsp;
                    </a>
                    {/section}

                    <a href="channel.php?pageIndex={$rightPageIndex}">&gt;</a>
                    </td>
                    </tr>
                    </table>
                </form>
                </div>
                <!--全部用户的列表-->
      </div>
      <!-- 搜索用户并且进行修改 结束-->
      <div class="clr"></div>
      {if $channel.id neq ''}
      <!-- 编辑用户 -->
      <div class="clr" id="modifyChannelInfo">
      	<p><img src="{$projectUrl}/images/img_1.jpg" width="30px" height="30px"><span style="font-color:#C60; font-size:16px;">编辑频道</span></p>
                <div id = "modify_channel" style="font-size:14px;">
                <form action="channel.php?id={$channel.id}#modifyChannelInfo" method="post">
                <input type="hidden" name="action" id="action" value="modify"/>
                <input type="hidden" name="channelid" id="channelid" value="{$channel.id}"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px;">
                    	<tr>
                    		<td>名字</td><td><input type="text" id="name" name="name" size="14" value="{$channel.name}"/></td>
                    		<td>介绍</td><td><input type="text" id="info" name="info" size="30" value="{$channel.info}"/></td>
                    		<td>保存</td><td><input type="image" src="{$projectUrl}/images/save.jpg" class="button"/></td>
                    	</tr>
                    </table>
                </form>
                </div>
      </div>
      <!-- 编辑频道结束 -->
      <div class="clr">
      	<span><a href="channel.php?id={$channel.id}&choice=teacher#addChannelTeacher"  style="font-size:{if $choice eq "teacher"}12px;{else}10px;color:#AAAAAA{/if}">
      		列出频道下的老师
      		</a>
      		</span>&nbsp;&nbsp;<span><a href="channel.php?id={$channel.id}&choice=device#addChannelDevice"  style="font-size:{if $choice eq "device"}12px{else}10px;color:#AAAAAA{/if}">
      			列出频道下的设备</a></span>
      </div>
      {/if}
      
       <!-- 编辑频道与教师的关系 -->
      {if $teachers neq ''}
      <div class="clr" id="addChannelTeacher" >
      	<p><img src="{$projectUrl}/images/img_1.jpg" width="30px" height="30px"><span style="font-color:#C60; font-size:16px;">编辑频道管理老师({$userCourses|@count})</span></p>
                <div id = "modify_user" style="font-size:14px;">
                <form action="channel.php?pageIndex={$pageIndex}&id={$channel.id}&choice={$choice}#addChannelTeacher" method="post">
                <input type="hidden" name="action" id="action" value="addTeacher"/>
                <input type="hidden" name="channelId" id="channelId" value="{$channel.id}"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px;">
                    	<tr>
                    		<td>{$channel.name}</td>
                    		<td>教师:
                    			<select id="teacherid" name="teacherid">
	                        {foreach from=$teachers item=teacherItem name=teacherslist}
	                        <option value="{$teacherItem.id}">{$teacherItem.name}({$teacherItem.id})</option>
	                        {/foreach}
	                        </select>
                    		</td>
                    		<td><input type="image" src="{$projectUrl}/images/add1.jpg" class="button"/>
                    			</td>
                    	</tr>
                    </table>
                </form>
                </div>
      </div>
      {/if}
      <!-- 编辑频道与教师的关系 结束 -->
      {if $listChannelTeachers neq ''}
      <!-- 列出编辑频道与教师的关系 -->
      <div class="clr" id="removeChannelTeacher"> 
      	<table width="100%" bgcolor="#FFFFFF" style="font-size:14px;">
                    <tr valign="top"  style="background-color:#C60">
                    		<td>编号</td>
                        <td>名字</td>
                        <td>删除</td>
                    </tr>
                    {foreach from=$listChannelTeachers item=channelTeacher name=channelTeacherList}
                    <tr valign="top"  onmouseout="this.style.backgroundColor=''"onmouseover="this.style.backgroundColor='#AAAAAA'">
                        <td>{$channelTeacher.id}</td>
                        <td>{$channelTeacher.name}</td>
                        <td><a href="channel.php?pageIndex={$pageIndex}&teacherid={$channelTeacher.id}&id={$channel.id}&choice=teacher&action=removeChannelTeacher#removeChannelTeacher">
                        	<span style="color:#red">删除</span></a>
                        		</td>
                    </tr>
                    {/foreach}
                    </table>	
      </div>
      <!-- 列出编辑频道与教师的关系 end-->
      {/if}
      
      <!-- 编辑频道与设备的关系 -->
      {if $choice eq 'device'}
      <div class="clr" id="addChannelDevice" >
      	<p><img src="{$projectUrl}/images/img_1.jpg" width="30px" height="30px"><span style="font-color:#C60; font-size:16px;">编辑频道与设备({$listChannelDevices|@count})</span></p>
                <div id = "modify_device" style="font-size:14px;">
                <form action="channel.php?pageIndex={$pageIndex}&id={$channel.id}&choice={$choice}#addChannelDevice" method="post">
                <input type="hidden" name="action" id="action" value="addDevice"/>
                <input type="hidden" name="channelId" id="channelId" value="{$channel.id}"/>
                    <table bgcolor="#FFFFFF" width="100%" style="font-size:14px;">
                    	<tr>
                    		<td>{$channel.name}</td>
                    		<td>设备:
                    			<select id="deviceId" name="deviceId">
	                        {foreach from=$devices item=deviceItem name=deviceslist}
	                        <option value="{$deviceItem.id}">{$deviceItem.name}({$deviceItem.barcode})</option>
	                        {/foreach}
	                        </select>
                    		</td>
                    		<td><input type="image" src="{$projectUrl}/images/add1.jpg" class="button"/>
                    			</td>
                    	</tr>
                    </table>
                </form>
                </div>
      </div>

      <!-- 列出 编辑频道与设备的关系 -->
      <div class="clr" id="removeChannelDevice"> 
      	<table width="100%" bgcolor="#FFFFFF" style="font-size:14px;">
                    <tr valign="top"  style="background-color:#C60">
                    		<td>条形码</td>
                        <td>名字</td>
                        <td>备注</td>
                        <td>删除</td>
                    </tr>
                    {foreach from=$listChannelDevices item=channelDevice name=channelDeviceList}
                    <tr valign="top"  onmouseout="this.style.backgroundColor=''"onmouseover="this.style.backgroundColor='#AAAAAA'">
                        <td>{$channelDevice.barcode}</td>
                        <td>{$channelDevice.name}</td>
                        <td>{$channelDevice.info|truncate:30:".."}</td>
                        <td><a href="channel.php?pageIndex={$pageIndex}&deviceId={$channelDevice.id}&id={$channel.id}&choice={$choice}&action=removeChannelDevice#removeChannelDevice">
                        	<span style="color:#red">删除</span></a>
                        		</td>
                    </tr>
                    {/foreach}
                    </table>	
      </div>
      <!-- 列出 编辑频道与设备的关系 end-->
      {/if}

    </div>
    <div class="clr"></div>
  </div>
  <div class="footer">
    {include file=include/footer.html}
  </div>
</div>
<div align=center></div></body>
</html>
